package com.yunti.springboot.util;


import org.apache.commons.collections4.Get;

import java.time.LocalDate;

public class GradeYearUtil {

    //获取当前学年
    public static int getGradeYear(){
        // 获取当前日期
        LocalDate currentDate = LocalDate.now();
        int year = currentDate.getYear();
        int month = currentDate.getMonthValue();
        if(month >= 8){
            return year;
        }
        return year - 1;
    }

    //通过年级(1,2,3)获取当前学年
    public static int getGradeYearByYear(int stuYear){
        // 获取当前日期
        LocalDate currentDate = LocalDate.now();
        int year = getGradeYear();
        return year + 1 - stuYear;
    }
}
